package com.sanji.sjmallmodule.account;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sanji.sjmallapp.BaseActivity;
import com.sanji.sjmallapp.R;
import com.sanji.sjmallwidget.XListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/***
 * 我的钱包
 ***/
public class MyWalletActivity extends BaseActivity implements View.OnClickListener, XListView.IXListViewListener {

    @BindView(R.id.common_back_img)
    ImageView commonBackImg;
    @BindView(R.id.common_left_tv)
    TextView commonLeftTv;
    @BindView(R.id.common_right_tv)
    TextView commonRightTv;
    @BindView(R.id.my_balance_relative)
    RelativeLayout myBalanceRelative;
    @BindView(R.id.my_red_packet_relative)
    RelativeLayout myRedPacketRelative;
    @BindView(R.id.my_wallet_list_view)
    XListView walletListView;
    Intent intent = null;
    BusinessDetailAdapter adapter;
    private List<BusinessDetailBean> businessData;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_wallet);
        ButterKnife.bind(this);
        initView();
    }

    public void initView() {
        commonLeftTv.setText(getString(R.string.my_wallet));
        commonRightTv.setText(getString(R.string.settings));
        businessData = new ArrayList<>();
        //模拟数据
//        businessData.add(new BusinessDetailBean("JY93615109", "2016-11-02", "微信支付", -1, 0));
//        businessData.add(new BusinessDetailBean("JY93615109", "2016-11-03", "钱包和线上支付混合支付--订单支付--改--钱包和pos混合支付", -1, 1));
        adapter = new BusinessDetailAdapter(this, businessData);
        walletListView.setAdapter(adapter);

        walletListView.setXListViewListener(this);
        walletListView.setPullLoadEnable(false);
        walletListView.setFooterDividersEnabled(false);
        walletListView.setHeaderDividersEnabled(false);

        commonBackImg.setOnClickListener(this);
        commonRightTv.setOnClickListener(this);
        myRedPacketRelative.setOnClickListener(this);
        myBalanceRelative.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.common_back_img:
                finish();
                break;
            case R.id.common_right_tv:
                //设置
                intent = new Intent(this, SetUserInfoActivity.class);
                startActivity(intent);
                break;
            case R.id.my_red_packet_relative:
                //红包
                intent = new Intent(this, MyRedPacketDetailActivity.class);
                startActivity(intent);
                break;
            case R.id.my_balance_relative:
                //我的余额
                intent = new Intent(this, BusinessDetailActivity.class);
                startActivity(intent);
                break;
        }
    }

    /**
     * 网络请求数据
     */
    public void requestData() {

    }

    @Override
    public void onRefresh() {

    }

    @Override
    public void onLoadMore() {

    }
}
